package com.njzxw.fs.commonutil.bean;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 常用帮助类
 */
@Getter
@Setter
@ToString
@Service
public class Common {

    /**
     * 默认缓存名称
     */
    private String CacheName = "defaultCache";

    /**
     * 用户信息缓存名称
     */
    private String userCacheName = "userCache";

    /**
     * 后台所有请求的url链接
     */
    private List<String> urlList = new ArrayList<String>();

    private List<SystemGroupBean> systemGroupList;

    /**
     * 获取系统设置单挑值
     *
     * @param groupCode
     * @return
     */
    public String getSystem(String groupCode){

//        System.out.println(systemGroupList);

        for(int i=0;i<systemGroupList.size();i++){
            if(systemGroupList.get(i).getGroupcode().equals(groupCode)){
                return systemGroupList.get(i).getValues();
            }
        }
        return "";
    }

    public List<SystemItemBean> getSystemList(String groupCode) {
        for (int i = 0; i < systemGroupList.size(); i++) {
            if (systemGroupList.get(i).getGroupcode().equals(groupCode)) {
                return systemGroupList.get(i).getItemList();
            }
        }
        return new ArrayList<>();
    }

}
